#{set title: 'Edit entity'/}
<html>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="@{'/public/javascripts/jquery.validate.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/jquery.validate.min.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/validation.js'}"></script>
	<script type="text/javascript">
			function back(orgId, entId) {
				$.ajax({
				   type: "GET",
				   url: "/EEntities/back",
				   data: "orgId="+orgId+"&entId="+entId,
				   success: function(html){
				     $("#orgEntities").replaceWith(html);
				   }
				 });
				 
				 }
</script>

#{if session.get("username") == null || session.get("username").equalsIgnoreCase("guest")}
<div class="error">
	<p class="error"> You must be connected to edit an organization </p>
</div>
<br></br>

<script type="text/javascript">

      $(document).ready(function() {
	
 		$('#background').hide().addClass( 'positioned' ); 
 			});
</script>

<a href = "@{Secure.login()}" > login now</a>
<a href="@{Users.register()}">New user? register now!</a>
#{/if}


<body>
<div id="background">
<div id="orgEntities">

<form id="editEntityForm" action="@{EEntities.editEntity()}" method="POST" >
			<input type = "hidden" name = "entId" value = ${ent.id} ></input>
			<br></br>
			
			<div class="formEntry">
				<div class="formLabel">
					<label>Entity Name</label>
				</div>
			<input class="inputText" type="text" name="entName" value = ${ent.name} ></input>

			<div class ="clear"></div></div>
			
			<div class="formEntry">
				<div class="formLabel">
					<label>Entity Lock Status</label>
				</div>
			<input class="inputText" type="radio" name="lock" value="0" 
			#{if !ent.isLock}
				checked = "checked"
			#{/if}
				/> <label>open</label>
			<input class="inputText" type="radio" name="lock" value="1" 
			#{if ent.isLock}
				checked = "checked"
			#{/if}
			/> <label>locked</label>

			<div class="clear"></div></div>

			<div class="formEntry">
				<div class="formLabel">
					<label>Description</label>
				</div>
			<input class="inputText" type="text" name="entDescription" value = ${ent.description} ></input>

			<div class="clear"></div></div>
				<div class ="formEntry">			
			<input type="submit" value="submit" id="submit"></input>
			</div>
		</form>
	
<a class="standardLink" href="javascript:back(-1,${ent.id})"> back </a>
</div>		
</div>
</body>
</html>